<?php

session_start();

if(isset($_SESSION['uid'])) {
	header("Location: index.php?action=main");
}

if($_GET['login']) {

$username = $_POST['username'];
$password = $_POST['password'];

if($username == "lol") {
	$_SESSION['uid'] = 1;
	header("Location: index.php");
} else {
	header("Location: login.php");
}


} else { ?>


<table>
<form action="?login=true" method="post">
<tr><td>Username:</td><td><input type="text" name="username" /></td></tr>
<tr><td>Password:</td><td><input type="password" name="password" /></td></tr>
<tr><td></td><td><input type="submit" value="Login" /></td></tr>
</form>
</table>


<?php } ?>